﻿using System;
using System.Windows.Forms;

namespace CnSharp.SSMS.Demo.Controls
{
    internal class ResultItem : ListViewItem
    {
        private string _type;


        public int Id { get; set; }


        public string Type
        {
            get { return _type; }
            set { _type = value;

            switch (_type.ToUpper())
            {
                case "P":
                    ImageIndex = 2;
                    break;
                case "FN":
                    ImageIndex = 3;
                    break;
                case "TF":
                    ImageIndex = 4;
                    break;
                case "TR":
                    ImageIndex = 5;
                    break;
                case "U":
                    ImageIndex = 0;
                    break;
                case "V":
                    ImageIndex = 1;
                    break;
            }
            }
        }

        public ShortObjectTypes ShortObjectType
        {
            get { return (ShortObjectTypes) Enum.Parse(typeof (ShortObjectTypes), _type); }
        }

        public string Schema { get; set; }

        public string Definition { get; set; }
    }
}